import { PostRiskScheme } from '@shared/interfaces/post-risk-control'
import { FormGroup, FormBuilder } from '@angular/forms'
import { PostRiskStoreService } from './post-risk-store.service'

export abstract class RiskControlNewBaseClass {
  riskControl: PostRiskScheme
  validateForm: FormGroup
  constructor(public fb: FormBuilder, public riskStore: PostRiskStoreService) {
    this.validateForm = this.fb.group({})
    this.initData()
  }

  initData(): void {
    this.riskStore.value$.subscribe(riskControl => (this.riskControl = riskControl))
  }

  checkValid(): boolean {
    this.pushDataToStore()
    return true
  }

  abstract pushDataToStore(): void
}
